<!-- <template>
  <div>
    <button @click="handlePayment">立即支付</button>
    <div v-html="payForm" ref="payForm"></div>
  </div>
</template>

<script setup>
import { ref } from "vue";
import { alipay, } from "@/api/fee/pay";
const payForm = ref("");

const handlePayment = async () => {
  try {
    //   const response = await axios.post('/api/pay/create', {
    //     outTradeNo: 'ORDER_' + Date.now(),
    //     totalAmount: '0.01',
    //     subject: '在线问诊'
    //   })
    const data = {
      outTradeNo: "ORDER_" + Date.now(),
      totalAmount: "0.01",
      subject: "在线问诊",
    };
    const response = await alipay(data);

    payForm.value = response.data;
    // 自动提交表单
    nextTick(() => {
      document.forms[0].submit();
    });
  } catch (error) {
    console.error("支付请求失败:", error);
  }
};
</script> -->
